// 设置 cookie
export function setCookie (name, value, time = 7200) {
    //  设置过期时间为
    document.cookie = `${name }=${ value };Max-Age=${ time };path=/`
  }
  
  // 获取 cookie
  export function getCookie (cname) {
    const name = `${cname }=`
    const ca = document.cookie.split(';')
    for (let i = 0; i < ca.length; i++) {
      let c = ca[i]
      while (c.charAt(0) === ' ') {
        c = c.substring(1)
      }
      if (c.indexOf(name) === 0) {
        return c.substring(name.length, c.length)
      }
    }
    return ''
  }
  
  // 删除 cookie
  export function removeCookie (name) {
    document.cookie = `${name}=;Max-Age=0;path=/`
  }